<titlemenu></titlemenu>
<div class="dj-card">
    <div class="dj-body" activate-input activate-select>
        <form role="form" name="assesTemplateform" novalidate>
            <div class="dj-formtable">
                <table class="dj-table dj-table3">
                    <tr>
                        <th>年度<span style="color: red;">*</span></th>
                        <td ng-class="{ 'has-error' : this.assesTemplateform.year.$invalid && this.assesTemplateform.$submitted}">
                            <input name="year" class="form-control" ng-model="dataModel.year"
                                   data-date-type="string" data-date-format="yyyy" type="text" ng-change="checkYear()"
                                   data-start-view="2" data-min-view="2"  autocomplete="off" autoclose="true" bs-datepicker
                                   ng-required="true"/>
                        </td>
                        <th>模板名称<span style="color: red;">*</span></th>
                        <td ng-class="{ 'has-error' : this.assesTemplateform.templateName.$invalid && this.assesTemplateform.$submitted}">
                            <input type="text" name="templateName" ng-model="dataModel.templateName"
                                   maxlength="50"
                                   class="form-control" ng-required="true"/>
                        </td>
                        <td colspan="2"></td>
                    </tr>
                </table>
            </div>
            <div class="dj-formtable">
                <div class="table-responsive list-table-panel">
                    <div class="list-table-title">
                        <div class="table-title">
                            考核项目({{dataModel.itemList.length}})
                        </div>
                        <div class="table-tool">
                            <button type="button" class="btn btn-primary dropdown-toggle"
                                    ng-click="addItem()" title="新增考核项目">
                                新增考核项目
                            </button>
                        </div>
                    </div>
                    <div>
                        <table class="table-bordered  js-basic-example dataTable" style="width: 100%;max-width: 100%;margin-bottom: 20px;">
                            <thead>
                            <tr>
                                <th class="th-rownum text-center">序号</th>
                                <th class="text-center" style="width: 150px;">所属项目</th>
                                <th class="text-center" style="width: 70px;">分值</th>
                                <th class="text-center">评比内容</th>
                                <th class="text-center">评比标准</th>
                                <th style="width: 150px;">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="it in dataModel.itemList  track by $index">
                                <td class="text-center" scope="row">{{$index + 1}}</td>
                                <td class="text-center">{{it.itemName}}</td>
                                <td class="text-center">{{it.itemScore}}</td>
                                <td style="min-width:300px;white-space:pre-line;" class="text-center">{{it.content}}</td>
                                <td style="min-width:300px;white-space:pre-line;" class="text-center">{{it.standard}}</td>
                                <td class="text-center">
                                    <button class="btn td-btn bg-pink waves-effect"
                                            ng-click="editItem(it,$index)" title="编辑">
                                        编辑
                                    </button>
                                    <button class="btn td-btn bg-pink waves-effect" ng-if="it.isUse == null"
                                            ng-click="deleteItem(it.id, $index)" title="删除">
                                        删除
                                    </button>
                                </td>
                            </tr>
                            <tr>
                                <th colspan="2" style="text-align: right">总分：</th>
                                <th class="text-center">{{sumScore}}</th>
                                <td></td>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr ng-if="dataModel.itemList.length<=0">
                                <td colspan="7" style="text-align:center">暂无数据</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="form_foot" style="margin-right: 20px;">
                <button type="button" class="btn btn-default" ng-click="pagechange();">取消</button>
                <button type="submit"
                        class="btn btn-primary"
                        ng-click="submitData(this.assesTemplateform.$valid)">保存
                </button>
            </div>
        </form>
    </div>
</div>